package leetcode2;
import java.util.*;
public class test5 {
    public int maxArea(int[] height) {
       int maxArea = 0;
       int left = 0,right = height.length - 1;
       while (left < right){
           int area = (right-left) * Math.min(height[left],height[right]);
           if(height[left] < height[right]){
               left++;
           }
           else {
               right--;
           }
           maxArea = Math.max(maxArea,area);
       }
       return maxArea;
    }
}
